<extend name="Users:layout" />
<block name="content">
<style>
    .wst-account .yue{margin:20px;float:left;}
    .wst-account .tixian{float:left;margin:20px;}
    .wst-account .chongzhi{float:left;margin:20px;}
    .wst-account{background-color: #fcfae2}
    .wst-details{margin-bottom: 35px;}
    .wst-details .zichan{font-size: 14px;margin:18px;}
    .wst-details .classify,.time{margin:16px;}
    .wst-details span{color:#999;padding-right:20px;float:left;}
    .wst-log th{background-color: #fcfae2}
    .wst-log td{text-align: center;border-bottom: 1px solid #aaa}
    .wst-details li {
        line-height: 25px;
        float: left;
        text-align: center;
        margin-left: 5px;
        padding-left: 8px;
        padding-right: 8px;
    }
    .wst-details li:hover {
        background-color: #e23e3d;
        border-radius: 5px;
        color: #ffffff;
        cursor: pointer
    }
    .wst-details .searched{
        background-color: #e23e3d;
        border-radius: 5px;
        color: #ffffff;
        cursor: pointer
    }
</style>
<script>
    $(function(){
            <if  condition="$checkApplyTime['day'] gt 0">
            //距离上次提现为到期
                var time =  {$checkApplyTime["day"]};
            applyOpen(time);
            <else/>
            <if condition="$info['agentWaitPrice'] neq 0">
                    applyHover();
            <elseif condition="$info['agentWaitPrice'] eq 0"/>
                    open()
                    </if>

            </if>
        //充值
        $('#apply').click(function(){
            location.href=Think.U('/Home/UsersAccount/toCharge');
        });
        //提现
        function  open(){
            $('#applyMoney').on('click',function(){
                openagent();
            })
        };
    })
    function getType(time,mark){
        var params = {};
        params.mark = mark;
        params.time = time;
        location.href = Think.U('Home/UsersAccount/queryYue',params);
    }
</script>
    <div class="wst-body"> 
        <div class='wst-page-header'>买家中心 > 我的余额</div>
        <div class='wst-page-content'>
       	<div class='wst-account'>
            <div class="yue">
                您当前的余额：<span style="font-size: 20px;color:red">{$userMoney}</span>元
            </div>
            <div class="tixian" >
                <button id="apply" class="wst-btn-query">充值</button>
            </div>
            <div class="chongzhi">
                <button id="applyMoney" class="wst-btn-query">提现</button>
            </div>
            <div class="wst-clear"></div>
        </div>
        <div class='wst-details'>
            <div class='zichan'>用户资产明细</div>
            <div class='classify'>
                <span>分类</span>
                <li <if condition="$mark eq 0" >class="searched"</if> onclick="getType({$time},0)">全部</li>
                <li <if condition="$mark eq 1" >class="searched"</if> onclick="getType({$time},1)">下单成功</li>
                <li <if condition="$mark eq 2" >class="searched"</if> onclick="getType({$time},2)">退款</li>
                <li <if condition="$mark eq 3" >class="searched"</if> onclick="getType({$time},3)">充值</li>
                <li <if condition="$mark eq 4" >class="searched"</if> onclick="getType({$time},4)">提现</li>
                <!--<li <if condition="$mark eq 5" >class="searched"</if> onclick="getType({$time},5)">订单无效</li>
                <li <if condition="$mark eq 6" >class="searched"</if> onclick="getType({$time},6)">活动</li>
                <li <if condition="$mark eq 7" >class="searched"</if> onclick="getType({$time},7)">评价</li>-->
            </div>
            <div class="wst-clear"></div>
            <div class="time">
                <span>时间</span>
                <li <if condition="$time eq 0" >class="searched"</if> onclick="getType(0,{$mark})">全部</li>
                <li <if condition="$time eq 1" >class="searched"</if> onclick="getType(1,{$mark})">今天</li>
                <li <if condition="$time eq 2" >class="searched"</if> onclick="getType(2,{$mark})">近7天</li>
                <li <if condition="$time eq 3" >class="searched"</if> onclick="getType(3,{$mark})">近15天</li>
                <li <if condition="$time eq 4" >class="searched"</if> onclick="getType(4,{$mark})">1个月</li>
                <li <if condition="$time eq 5" >class="searched"</if> onclick="getType(4,{$mark})">半年</li>
                <li <if condition="$time eq 6" >class="searched"</if> onclick="getType(4,{$mark})">1年</li>
            </div>
        </div>
        <div class="wst-log">
            <table id="logInfo" cellspacing="0" width="100%">
               <thead>
                   <tr>
                        <th width='10%'>日期</th>
                        <th width='30%'>交易类型</th>
                        <th width='25%'>金额变更</th>
                        <th width='35%'>余额</th>
                    </tr>
               </thead>
               <tbody>
                <volist name="pages['root']" key="key" id="record">
                    <tr>
                        <td><php>echo date('Y-m-d H:i:s',$record['time'])</php></td>
                        <td>
                            <if condition='$record["type"] eq 1'>下单成功
                                <elseif condition='$record["type"] eq 2'/>退款
                                <elseif condition='$record["type"] eq 3'/>充值
                                <elseif condition='$record["type"] eq 4'/>提现
                                </if>
                        </td>
                        <td><if condition="$record['IncDec'] eq 0"><span style="color:red">-{$record['money']}</span><else /><span style="color:green">+{$record['money']}</span></if></td>
                        <td>{$record['balance']}</td>
                    </tr>
                </volist>
                    <if condition="$pages['totalPage'] gt 1">
                        <tfoot>
                        <tr>
                            <td colspan='8' align='center' style="height:30px;border-bottom: 0px;">
                                <div class="wst-page" style="float:right;padding-bottom:10px;">
                                    <div id="wst-page-items">
                                    </div>
                                </div>
                            </td>
                        </tr>
                        </tfoot>
                    </if>
               </tbody>
            </table>
        </div>
    </div>
<script>
function openagent(){
    layer.open({
        type: 2,
        title:"申请提现",
        shade: [0.6, '#000'],
        border: [0],
        content: [Think.U('Home/Apply/payview')],
        area: ['805px', ($(window).height() - 150) +'px'],
        end:function(){
            window.location.reload();
        }
    });
}
<if condition="$pages['totalPage'] gt 1">
$(document).ready(function(){
    laypage({
        cont: 'wst-page-items',
        pages: {$pages['totalPage']}, //总页数
        skip: true, //是否开启跳页
        skin: '#e23e3d',
        groups: 3, //连续显示分页数
        curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
            var page = location.search.match(/pcurr=(\d+)/);
            return page ? page[1] : 1;
        }(), 
        jump: function(e, first){ //触发分页后的回调
            if(!first){ //一定要加此判断，否则初始时会无限刷新
                var nuewurl = WST.splitURL("pcurr");
                var ulist = nuewurl.split("?");
                if(ulist.length>1){
                    location.href = nuewurl+'&pcurr='+e.curr;
                }else{
                    location.href = '?pcurr='+e.curr;
                }
                
            }
        }
    });
});
</if>

</script>
</block> 